<?php
include_once("../includes/global.php");
$script_tmp = explode('/', $_SERVER['SCRIPT_NAME']);
$sctiptName = array_pop($script_tmp);
$config['language'] = isset($_SESSION["ADMIN_LANG"])?$_SESSION["ADMIN_LANG"]:$config['language'];
include_once("../lang/" . $config['language'] . "/admin.php");
include_once("auth.php");
include_once("menu_config.php");
//====================================
if(empty($_SESSION["ADMIN_USER"]))
	msg("index.php");

function list_sub($sv,$sub=NULL,$last=NULL)
{
	global $perm,$lang,$bnums,$j;
	$u_v=explode(",",$sv);
	if($u_v[1]==1&&(in_array(md5($u_v[0]),$perm)||$_SESSION["ADMIN_TYPE"]=='1'))
	{
		$str.='<tr height=17>';
		if(!empty($sub))
		{
			$str.='<td width="25" valign="middle" class="subtd">';
			$str.='</td>';
		}
		else
			$co="colspan=2";
		if(count($u_v)>=3)
			$str.='<td '.$co.' class="subtd"><img src=\'../image/admin/jiantou.jpg\'><a href="module.php?m='.$u_v[2].'&s='.$u_v[0].'" onClick="javascript:document.all.main.src=\'module.php?m='.
			$u_v[2].'&s='.$u_v[0].'\';return false;">';
		else
			$str.="<td $co class='subtd'><img src='../image/admin/jiantou.jpg'><a href='$u_v[0]' onClick=\"javascript:document.all.main.src='".$u_v[0]."';return false;\">";
		
		$sar=explode('?',$u_v[0]);
		$u_v[0]=$sar[0];
		$scrp_name=substr($u_v[0],0,-4);
		if(!empty($u_v[3]))
			$str.=$u_v[3];
		else
			$str.=$lang[$scrp_name];
		$str.='</a></td></tr>';
	}
	return $str;
}
?>
<html>
<head>
<title><?php echo lang_show('business_manager_system');?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="main.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../script/my_lightbox.js"></script>
<script>
closeimg='<?php echo $config['weburl'];?>/image/default/icon_close.gif';
</script>
</head>
<body class="nbg">
<table width="98%" border="0" cellspacing="0" cellpadding="0" height="99%" >
  <tr>
    <td colspan="2"  height="10%" align="left" valign="bottom" style="padding-top:10px; padding-left:5px;">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td style="border-bottom:2px solid #41B3D5;width:230px;">
		<img src="../image/admin/logo.png" width="225" height="42" align="bottom">
	</td>
    <td valign="bottom" style="border-bottom:2px solid #41B3D5;">
	    <ul class="nav" style="float:left; width:700px; overflow:hidden; margin-left:10px;">
		<li class="nav_left"></li>
        <?php
			if(empty($perm))
				$perm=array();
			foreach($mem as $key=>$v)
			{
			 if(in_array(md5($key),$perm)||$_SESSION["ADMIN_TYPE"]=='1')
			 {
			 	if(is_array($v[1][0]))
				{
					$i==0;
					if($i==0)
					{
						$curren_key=$key;
						$i=1;
					}
			   		$to_url=@explode(",",$v[1][0]);
				}
			?>
			<li id="navKB<?php echo $key;?>" class="nav_c"><a  onClick="expandIt('KB<?php echo $key;?>','<?php echo $to_url[0];?>'); return false" href="#"><?php echo $v[0];?></a> </li>
			  <?php
			}}
		?><li class="nav_right"></li>

        </ul>
		<div style="290px; text-align:right; float:right; padding-top:15px;">
		   <?php echo $_SESSION["ADMIN_USER"];?> 
		   <a style="color:#FF0000;" href="index.php?action=logout" target="_top"><?php echo lang_show('log_out');?>,</a>
			<?php echo lang_show('mangr');?>
			<?php
			 if($_SESSION["province"]=="")
				echo lang_show('mgall');
			 else
				echo $_SESSION["province"].$_SESSION["city"];
			 ?>
			 <a target="_blank" href="<?php echo $config['weburl'];?>">
			 <font color="#FF0000">
			 <?php echo lang_show('siteindex');?>
			 </font>
			 </a>
       </div>
</td>
  </tr>
</table>
    </td>
  </tr>
   <tr>
    <td align="left" valign="top" style="padding-top:11px; width:10%;">
    <div class="menu_list">
      <table width="198" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="9"><img src="../image/admin/left_t.jpg"></td>
        </tr>
        <tr>
          <td class="neirong"><?php
foreach($mem as $key=>$v)
{
?>
            <div class="sub" id="KB<?php echo $key;?>" <?php if(!$key){echo 'style="display:block"';}?>>
              <table width="150px"  border="0" cellspacing="0" cellpadding="0" >
                <?php
	$j=1;
	foreach($v[1] as $sv)
	{
		$bnums=count($v[1]);
		if(is_array($sv))
		{	
			$nums=0;
			foreach($sv[1] as $nvv)
			{
				$u_v=explode(",",$nvv);
				if($u_v[1]==1)
					$nums++;
			}
			$i=1;
			echo '<tr><td class="first_menu" colspan=2><img src="../image/admin/icon.jpg" />'.$sv[0].'</td></tr>';			
			foreach($sv[1] as $sub_sv)
			{
				if($i==$nums)
					echo list_sub($sub_sv,'sub','last');
				else
					echo list_sub($sub_sv,'sub');
				$i++;
			}
		}
		else
		{
			echo list_sub($sv);
		}
		$j++;
	}
	?>
              </table>
            </div>
            <?php
}
?>
	</td>
	</tr>
	<tr>
	  <td height="11"><img src="../image/admin/left_b.jpg"></td>
	</tr>
  </table>
</div>
</td>
   
   
   
   
   
   
   
<td width="100%" rowspan="2" align="left" valign="top">
   <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td width="5">&nbsp;</td>
		<td height="5" style="background-image:url(../image/admin/ifc.jpg); background-position:0px 5px!important; background-position:0px 5px; background-repeat:repeat-x;">&nbsp;</td>
		<td width="5">&nbsp;</td>
	  </tr>
	</table>
    
<table height="95%" style="width:100%;" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="11" style="background-image:url(../image/admin/ifl.jpg); background-position:bottom; background-repeat:no-repeat;">&nbsp;</td>
    <td valign="top" class="nr"><iframe id="main" name="main" width="100%" frameborder="0" height="97%"></iframe>&nbsp;</td>
    <td width="11" style="background-image:url(../image/admin/ifr.jpg); background-position:bottom; background-repeat:no-repeat;">&nbsp;</td>
  </tr>
</table>  
</td>
  </tr>
</table>
<script>
document.getElementById('main').src='main_index.php';
function expandIt(id,to)
{
	for(i=0;i<7;i++)
	{
		ob="KB"+i;
		var obj=document.getElementById(ob);
		if(obj!="null")
			obj.style.display="none";
		var navd='navKB'+i;
		if(document.getElementById(navd))
		{
			document.getElementById(navd).className='nav_c';
			document.getElementById(navd).style.color="#FFFFFF";
		}
	}
	document.getElementById(id).style.display="block";
	
	var nd='nav'+id;
	document.getElementById(nd).className='nva_current';
	document.getElementById(nd).style.color="#000000";
}
expandIt('KB<?php echo $curren_key;?>','');
</script>
</body>
</html>